package com.hanthink.common.enums;

import com.hanthink.common.utils.StringUtils;

import java.util.Arrays;
import java.util.List;

/**
 * 部门角色枚举类
 *
 * @author WangBin
 * @since 2025-10-27
 */
public enum DepartmentRole {
    PRODUCTION_DEPT("生产部", "两片杭州隐患-生产部"),
    ENGINEERING_ELECTRICAL_DEPT("工程电气部", "两片杭州隐患-工程电气部"),
    ENGINEERING_EQUIPMENT_DEPT("工程设备部", "两片杭州隐患-工程设备部"),
    QUALITY_MANAGEMENT_DEPT("品质管理部", "两片杭州隐患-品质管理部"),
    ADMIN_PERSONNEL_DEPT("行政人事部", "两片杭州隐患-行政人事部"),
    LOGISTICS_DEPT("物流部", "两片杭州隐患-物流部"),
    SAFETY_ENVIRONMENTAL_DEPT("安全环保部", "两片杭州隐患-安全环保部");

    private String key;
    private String value;

    DepartmentRole(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static DepartmentRole valueByKey(String key) {
        if (StringUtils.isEmpty(key)) {
            return null;
        }
        for (DepartmentRole departmentRole : DepartmentRole.values()) {
            if (departmentRole.getKey().equals(key)) {
                return departmentRole;
            }
        }
        return null;
    }

    public static String getValue(String key) {
        if (StringUtils.isEmpty(key)) {
            return null;
        }
        for (DepartmentRole departmentRole : DepartmentRole.values()) {
            if (departmentRole.getKey().equals(key)) {
                return departmentRole.value;
            }
        }
        return null;
    }
}